package cn.iocoder.ny.module.mall.mapper;


import cn.iocoder.ny.module.mall.domain.MallBanner;
import cn.iocoder.ny.module.mall.domain.MallBannerPageVo;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface MallBannerMapper extends BaseMapperX<MallBanner> {
    int updateBatch(List<MallBanner> list);

    int batchInsert(@Param("list") List<MallBanner> list);

    default PageResult<MallBanner> selectPage(MallBannerPageVo mallBannerPageVo) {
        return selectPage(mallBannerPageVo,new LambdaQueryWrapperX<MallBanner>()
                .eqIfPresent( MallBanner::getTenantId,
                        mallBannerPageVo.getTenantId()).orderByDesc(MallBanner::getSort).orderByAsc(MallBanner::getCreateTime)
                .orderByAsc(MallBanner::getUpdateTime));
    }
}
